import 'package:library_base/entities/generated/json/base/json_convert_content.dart';
import 'package:library_base/entities/suppliers_shops_list_entity.dart';
import 'package:library_base/entities/task_detail_child_child_entity.dart';
import 'package:library_base/entities/task_detail_child_entity.dart';
import 'package:library_base/entities/task_detail_entity.dart';

TaskDetailEntity $TaskDetailEntityFromJson(Map<String, dynamic> json) {
  final TaskDetailEntity loginBeanEntity = TaskDetailEntity();

  final List<TaskDetailChildEntity> details =
      jsonConvert.convertList<TaskDetailChildEntity>(json['details']);
  loginBeanEntity.details = details;

  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    loginBeanEntity.id = id;
  }

  final String? purchaseOrderNumber = jsonConvert.convert<String>(json['purchaseOrderNumber']);
  if (purchaseOrderNumber != null) {
    loginBeanEntity.purchaseOrderNumber = purchaseOrderNumber;
  }
  final String? supplierId = jsonConvert.convert<String>(json['supplierId']);
  if (supplierId != null) {
    loginBeanEntity.supplierId = supplierId;
  }
  final String? supplierName = jsonConvert.convert<String>(json['supplierName']);
  if (supplierName != null) {
    loginBeanEntity.supplierName = supplierName;
  }
  final String? warehouseId = jsonConvert.convert<String>(json['warehouseId']);
  if (warehouseId != null) {
    loginBeanEntity.warehouseId = warehouseId;
  }
  final String? warehouseName = jsonConvert.convert<String>(json['warehouseName']);
  if (warehouseName != null) {
    loginBeanEntity.warehouseName = warehouseName;
  }
  final String? shipperId = jsonConvert.convert<String>(json['shipperId']);
  if (shipperId != null) {
    loginBeanEntity.shipperId = shipperId;
  }

  final String? remark = jsonConvert.convert<String>(json['remark']);
  loginBeanEntity.remark = remark??"";

  final String? shipperName = jsonConvert.convert<String>(json['shipperName']);
  if (shipperName != null) {
    loginBeanEntity.shipperName = shipperName;
  }

  if(json['shop'] == null){
    loginBeanEntity.shop = null;
  }else{
    loginBeanEntity.shop = SuppliersShopsListEntity.fromJson(json['shop']);
  }
  return loginBeanEntity;
}

Map<String, dynamic> $TaskDetailEntityToJson(TaskDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['details'] = entity.details;
  data['purchaseOrderNumber'] = entity.purchaseOrderNumber;
  data['id'] = entity.id;
  data['supplierId'] = entity.supplierId;
  data['supplierName'] = entity.supplierName;
  data['warehouseId'] = entity.warehouseId;
  data['warehouseName'] = entity.warehouseName;
  data['shipperId'] = entity.shipperId;
  data['shipperName'] = entity.shipperName;
  data['remark'] = entity.remark;
  data['shop'] = entity.shop;
  return data;
}
